'''bench.py --- simple benchmarking script for IOKS'''

import os
import sys
from fill_db import fill_db


def bench(npages, uniform):
    fill_db(npages, uniform)
    print '- done generating for N = %d, uniform = %s' % (npages, str(uniform))
    os.system('mysql -t <bench.sql >>report.txt')

def main():
    if len(sys.argv) < 3:
        print 'please specify n_0 and number of steps'
        return
    os.remove('report.txt')
    n = int(sys.argv[1])
    steps = int(sys.argv[2])
    for i in xrange(steps):
        bench(n, True)
        bench(n, False)
        print '- done benchmarking for N = %d' % n
        n = int(n * 1.5)

if __name__ == '__main__':
    main()

